package com.bobo.serviceorder.conrtoller;

import com.bobo.serviceorder.service.GrabService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author bobo
 * @date 2021-04-12
 */
@RestController
@RequestMapping("/redisson/lock")
public class OrderRedissonLockController {

    @Autowired
    @Qualifier("grabRedissonLockServiceImpl")
    private GrabService grabService;

    @GetMapping("/grab/{orderId}")
    public String grab(@PathVariable("orderId") int orderId, int driverId) {
        System.out.println("orderId:" + orderId + " driverId:" + driverId);
        String s = grabService.grabOrder(orderId, driverId);
        return s;
    }
}
